package logic

import (
	"context"

	"go-zero-demo-04/mall/result/api/internal/svc"
	"go-zero-demo-04/mall/result/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetAnswerLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewGetAnswerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAnswerLogic {
	return &GetAnswerLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *GetAnswerLogic) GetAnswer(req *types.GetanswerRequest) (resp *types.GetanswerResponse, err error) {
	res, err := l.svcCtx.AnswerModel.FindOne(l.ctx, req.Time)
	if err != err {
		return nil, err
	}

	return &types.GetanswerResponse{
		Answer1:  res.Answer1,
		Answer2:  res.Answer2,
		Answer3:  res.Answer3,
		Answer4:  res.Answer4,
		Answer5:  res.Answer5,
		Answer6:  res.Answer6,
		Answer7:  res.Answer7,
		Answer8:  res.Answer8,
		Answer9:  res.Answer9,
		Answer10: res.Answer10,
		Answer11: res.Answer11,
		Answer12: res.Answer12,
		Answer13: res.Answer13,
		Answer14: res.Answer14,
		Answer15: res.Answer15,
		Answer16: res.Answer16,
		Answer17: res.Answer17,
		Answer18: res.Answer18,
		Answer19: res.Answer19,
		Answer20: res.Answer20,
		Answer21: res.Answer21,
		Answer22: res.Answer22,
		Answer23: res.Answer23,
		Answer24: res.Answer24,
		Answer25: res.Answer25,
		Answer26: res.Answer26,
		Answer27: res.Answer27,
		Answer28: res.Answer28,
		Answer29: res.Answer29,
		Answer30: res.Answer30,
		Answer31: res.Answer31,
		Answer32: res.Answer32,
		Answer33: res.Answer33,
		Answer34: res.Answer34,
		Answer35: res.Answer35,
		Answer36: res.Answer36,
		Answer37: res.Answer37,
		Answer38: res.Answer38,
		Answer39: res.Answer39,
		Answer40: res.Answer40,
		Answer41: res.Answer41,
		Answer42: res.Answer42,
		Answer43: res.Answer43,
		Answer44: res.Answer44,
		Answer45: res.Answer45,
		Answer46: res.Answer46,
		Answer47: res.Answer47,
		Answer48: res.Answer48,
		Answer49: res.Answer49,
		Answer50: res.Answer50,
		Answer51: res.Answer51,
		Answer52: res.Answer52,
		Answer53: res.Answer53,
		Answer54: res.Answer54,
		Answer55: res.Answer55,
		Answer56: res.Answer56,
		Answer57: res.Answer57,
		Answer58: res.Answer58,
		Answer59: res.Answer59,
		Answer60: res.Answer60,
		Answer61: res.Answer61,
		Answer62: res.Answer62,
		Answer63: res.Answer63,
		Answer64: res.Answer64,
		Answer65: res.Answer65,
		Answer66: res.Answer66,
		Answer67: res.Answer67,
		Answer68: res.Answer68,
		Answer69: res.Answer69,
		Answer70: res.Answer70,
		Answer71: res.Answer71,
		Answer72: res.Answer72,
		Answer73: res.Answer73,
		Answer74: res.Answer74,
		Answer75: res.Answer75,
		Answer76: res.Answer76,
		Answer77: res.Answer77,
		Answer78: res.Answer78,
		Answer79: res.Answer79,
		Answer80: res.Answer80,
		Answer81: res.Answer81,
		Answer82: res.Answer82,
		Answer83: res.Answer83,
		Answer84: res.Answer84,
		Answer85: res.Answer85,
		Answer86: res.Answer86,
		Answer87: res.Answer87,
		Answer88: res.Answer88,
		Answer89: res.Answer89,
		Answer90: res.Answer90,
		Answer91: res.Answer91,
		Answer92: res.Answer92,
		Answer93: res.Answer93,
	}, nil

}
